1 package mobisnap.mobile_trx; 2 3 import java.math.*; 4 5 /*** 6 * Used to represent variables and constants internally 7 */ 8 public class MSQLTChar extends MSQLTVariable 9 { 10 int size; 11 12 public MSQLTChar( boolean constant, boolean notnull, int size) { 13 super( constant, notnull); 14 this.size = size; 15 } 16 17 /*** 18 * Sets the value of the given variable 19 */ 20 public void setValue( Object obj) throws Exception { 21 if( constant && value != null) 22 throw new mobisnap.MobisnapException( "Assigning value to constant"); 23 if( obj instanceof String) { 24 if( size > 0 && ((String)obj).length() > size) 25 value = ((String)obj).substring( 0, size); 26 else 27 value = obj; 28 } else if( obj instanceof SQLNull && ! notnull) 29 value = obj; 30 else if( obj instanceof java.sql.Date) 31 setValue( obj.toString()); 32 else if( obj instanceof Boolean || MSQLTypeUtil.isDecimal( obj)) 33 setValue( obj.toString()); 34 else 35 throw new mobisnap.MobisnapException( "Invalid assgnment to char : " + obj.getClass().getName()); 36 } 37 }

This page was automatically generated by Maven